package com.scsj.cloud.base.util;

import com.scsj.cloud.base.rest.RestResponse;

/**
 * Rest处理工具类
 * 
 * @author caoxiubin
 */
public class RestUtils {

	public static RestResponse returnSuccess() {

		RestResponse restResponse = new RestResponse();
		restResponse.setStatus(RestResponse.SUCCESS);

		return restResponse;
	}

	public static RestResponse returnSuccess(String message) {

		RestResponse restResponse = new RestResponse();
		restResponse.setStatus(RestResponse.SUCCESS);
		restResponse.setMsg(message);

		return restResponse;
	}
	
	
	public static RestResponse returnSuccessWithString(String data) {

		RestResponse restResponse = new RestResponse();
		restResponse.setStatus(RestResponse.SUCCESS);
		restResponse.setData(data);

		return restResponse;
	}

	public static RestResponse returnSuccess(Object data) {

		RestResponse restResponse = new RestResponse();
		restResponse.setStatus(RestResponse.SUCCESS);
		restResponse.setData(data);

		return restResponse;
	}

	public static RestResponse returnSuccess(Object data, String message) {

		RestResponse restResponse = new RestResponse();
		restResponse.setStatus(RestResponse.SUCCESS);
		restResponse.setData(data);
		restResponse.setMsg(message);

		return restResponse;
	}

	public static RestResponse returnFailure(Object data) {

		RestResponse restResponse = new RestResponse();
		restResponse.setStatus(RestResponse.FAIL);
		restResponse.setData(data);

		return restResponse;
	}

	public static RestResponse returnFailure(Object data, String message) {

		RestResponse restResponse = new RestResponse();
		restResponse.setStatus(RestResponse.FAIL);
		restResponse.setData(data);
		restResponse.setMsg(message);

		return restResponse;
	}

	public static RestResponse returnFailure(String message) {

		RestResponse restResponse = new RestResponse();
		restResponse.setStatus(RestResponse.FAIL);
		restResponse.setMsg(message);

		return restResponse;
	}

}
